/*
 * @Description: 虚拟设备管理
 */
import zhreq from "@/api/axios";

export default {
  /**
   * @description: 分页查询获取列表
   * @param {String/Number} page *
   * @param {String/Number} size *
   */
  getlist(params) {
    let searchparams = {
      page: params.page,
      size: params.size,
      sort: "timestamp",
      entity: {
        "farmingTypeNo": sessionStorage.getItem('farmingTypeNo'),
        "vrtualDeviceName": params.searchname
      }
    }
    searchparams.entity.organizationNo = sessionStorage.getItem('parentId')
    return zhreq.post("/productionv2/vrtualDevice/queryPageList", searchparams);
  },
  /**
   * @description: 添加一条数据
   */
  addlist(params) {
    return zhreq.post("/vrtualDevice/add", {
      ...params
    });
  },
  /**
   * @description: 删除一条数据
   */
  dellist(params) {
    return zhreq.post("/vrtualDevice/delList", {
      vrtualDeviceIdList: params
    });
  },
  /**
   * @description: 修改一条数据
   */
  editlist(params) {
    return zhreq.post("/vrtualDevice/edit", {
      ...params
    });
  },
  /**
   * @description: 条件查询
   */
  byconditlist(params) {
    return zhreq.post("/vrtualDevice/queryByCondition", {
      ...params
    });
  },
  /**
   * @description: 主键查询
   */
  querylist(params) {
    return zhreq.get(`/vrtualDevice/query/${params}`);
  }
};
